import getDeviceInfo from '../common/deviceInfo'
// 解决ios上 快速删除时 出现乱选中的现象
Vue.directive('inputDelete', {
    inserted: function (el, bind) {
        if (getDeviceInfo().isIOS) {
            el.addEventListener('keydown', onInput)
        }
    },
    update: function (el, bind) {
        if (getDeviceInfo().isIOS) {
            el.removeEventListener('keydown', onInput)
            el.addEventListener('keydown', onInput)
        }
    }
})

function onInput(e){
    if (e.keyCode === 8) {
        window.requestAnimationFrame(() => {
        })
    }
}